package 课设;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.util.ArrayList;

public class manager_show extends JFrame {
    private JTable table;
    private MyTableModel tablemodel;
    private JButton b1,b3;
    private JToolBar tool;

    public manager_show() {
        this.setSize(800, 600);
        this.setTitle("manager");
        this.setLocationRelativeTo(getOwner());

        table = new JTable();
        table.setPreferredScrollableViewportSize(new Dimension(500, 300));
        JScrollPane scroll = new JScrollPane(table);
        getContentPane().add(scroll, BorderLayout.CENTER);

        b1 = new JButton("用户管理");
        b1.setToolTipText("添加");
        b1.setFocusable(false);
        b1.setHorizontalTextPosition(SwingConstants.CENTER);
        b1.setVerticalTextPosition(SwingConstants.BOTTOM);


        b3 = new JButton("博客管理");
        b3.setToolTipText("删除");
        b3.setFocusable(false);
        b3.setHorizontalTextPosition(SwingConstants.CENTER);
        b3.setVerticalTextPosition(SwingConstants.BOTTOM);

        //创建工具栏，添加按钮
        tool = new JToolBar();
        tool.add(b1);
        //tool.add(b2);
        tool.add(b3);
        tool.setRollover(true);

        //添加工具栏
        getContentPane().add(tool,BorderLayout.NORTH);
        b1.addActionListener(new ActionListener() {//用户管理
            public void actionPerformed(ActionEvent e) {
                usertable padd = new usertable();
                padd.setVisible(true);
                dispose();
            }
        });

        b3.addActionListener(new ActionListener() {//博客管理
            public void actionPerformed(ActionEvent e) {
                blogtable padd = new blogtable();
                padd.setVisible(true);
                dispose();
            }
        });
    }

    public static void main(String[] args) {
        manager_show a = new manager_show();
        a.setVisible(true);
    }
}
